<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head >
    <title>添加商品流量记录</title>
    <link rel="stylesheet" href="/layui/css/layui.css">
    <script src="/layui/layui.js"></script>
    <script>
        var index = 0;
        try{
            index = parent.layer.getFrameIndex(window.name); //获取窗口索引
        }catch (e) {
        }
    </script>
</head>
<body >

<div class="layui-body" style="padding-top:20px;">
    
    <div class="sp-wrapper">
        <div class="order-body">

            <form method="post" class="layui-form" id="sp-form">
                <div class="layui-form-item">
                    <label class="layui-form-label">店铺：</label>
                    <div class="layui-input-inline">
                        <select name="shopId" id="shopId" lay-verify="required">
                            <option value="" selected>请选择店铺</option>
                            <option  th:each="item: ${shops}" th:text="${item.name + ' - '+ item.typeName}" th:value="${item.id}">等待发货</option>
                        </select>
                    </div>
                    <div class="layui-input-inline">
                        <input type="text" name="date" id="date" lay-verify="required" th:value="${date}" readonly placeholder="日期" autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">商品ID</label>
                    <div class="layui-inline">
                        <input type="text" name="goodsId" lay-verify="required|number" th:value="${goodsNum}" placeholder="商品ID" autocomplete="off" class="layui-input">
                    </div>
                    <!-- <div class="layui-inline">
                        <input type="text" name="goodsNumber"  placeholder="商品编码" lay-verify="required" autocomplete="off" class="layui-input">
                    </div> -->
                    
                        
                    
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">访客数</label>
                    <div class="layui-inline">
                        <input type="text" name="visits"  placeholder="访客数"  style="width: 100px;" lay-verify="required|number"  autocomplete="off" class="layui-input">
                    </div>
                  
                    <div class="layui-inline">
                        <input type="text" name="views" lay-verify="required|number"  style="width: 100px;" placeholder="浏览量" autocomplete="off" class="layui-input">
                    </div>
                    <div class="layui-inline">
                        <input type="text" name="collects"  placeholder="收藏数" style="width: 100px;" autocomplete="off" class="layui-input">
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">下单</label>
                    <div class="layui-inline">
                        <input type="text" name="orderUsers"  placeholder="支付买家数"  style="width: 100px;"  autocomplete="off" class="layui-input">
                    </div>
                    <div class="layui-inline">
                        <input type="text" name="orders"  placeholder="下单数"  style="width: 100px;"  autocomplete="off" class="layui-input">
                    </div>
                   
                    <div class="layui-inline">
                        <input type="text" name="orderAmount"  placeholder="支付金额"  style="width: 100px;"  autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">支付转化率</label>
                    <div class="layui-inline">
                        <input type="text" name="CVR"  placeholder="支付转化率"  style="width: 100px;"  autocomplete="off" class="layui-input">
                    </div>
                    <div class="layui-inline" style="width: 80px;">
                        <select name="cvrTag" lay-verify="required" style="width: 80px;">
                            <option value="低" selected>低</option>
                            <option value="高">高</option>
                        </select>
                    </div>

                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">全站付费</label>
                    <div class="layui-inline">
                        <input type="text" name="paidShowQZ"  placeholder="全站曝光量" style="width: 100px;" autocomplete="off" class="layui-input">
                    </div>
                    <div class="layui-inline">
                        <input type="text" name="paidVisitQZ" placeholder="全站访客数" style="width: 100px;" autocomplete="off" class="layui-input">
                    </div>
                    <div class="layui-inline"> 
                        <input type="text" name="paidOrderQZ" placeholder="全站下单数" style="width: 100px;" autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">搜索付费</label>
                    <div class="layui-inline">
                        <input type="text" name="paidShowSS"  placeholder="搜索曝光量" style="width: 100px;" autocomplete="off" class="layui-input">
                    </div>
                    <div class="layui-inline">
                        <input type="text" name="paidVisitSS" placeholder="搜索访客数" style="width: 100px;" autocomplete="off" class="layui-input">
                    </div>
                    <div class="layui-inline"> 
                        <input type="text" name="paidOrderSS" placeholder="搜索下单数" style="width: 100px;" autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">场景付费</label>
                    <div class="layui-inline">
                        <input type="text" name="paidShowCJ"  placeholder="场景曝光量" style="width: 100px;" autocomplete="off" class="layui-input">
                    </div>
                    <div class="layui-inline">
                        <input type="text" name="paidVisitCJ" placeholder="场景访客数" style="width: 100px;" autocomplete="off" class="layui-input">
                    </div>
                    <div class="layui-inline"> 
                        <input type="text" name="paidOrderCJ" placeholder="场景下单数" style="width: 100px;" autocomplete="off" class="layui-input">
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">备注</label>
                    <div class="layui-input-inline">
                        <input type="text" name="remark" placeholder="" autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-input-block">
                        <button class="layui-btn" lay-submit lay-filter="add_btn">立即提交</button>
                        <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                        <button class="layui-btn layui-btn-primary" id="close_btn">关闭</button>
                    </div>
                </div>
            </form>
        </div>
    <script type="text/javascript" src="/sb/jquery.min.js"></script>
    <script type="text/javascript" src="/sb/Tips.min.js"></script>

    <!-- end sp-wrapper -->
    <script>
        layui.use(['laydate', 'form','layer'], function () {
            var laydate = layui.laydate;
            var form = layui.form;
            var layer = layui.layer;

            //执行一个laydate实例
            laydate.render({
                elem: '#date' //指定元素
            });
            $(function(){
                
                $("#shopId").val([[${shopId}]]);
                form.render('select');

                form.on('submit(add_btn)', function(data){
                console.log(data.field);
                $.ajax({
                    type:"POST",
                    url:"/shop/goods_traffic_pdd_add_ajax",
                    processData: false, //表明不要对数据进行处理
                    data:JSON.stringify(data.field),
                    contentType: 'application/json',
                    success:function (res) {
                        if(res.code == 0){
                            parent.layer.msg(res.msg)

                            $("#sp-form")[0].reset();
                            $("#shopId").val([[${shopId}]]);
                            form.render('select');
                            // parent.layer.close(index);
                            // parent.location.reload();
                        }else {
                            layer.msg(res.msg)
                        }
                        return false;
                    }
                });
                return false;
            });

                $("#close_btn").click(function (){
                    parent.layer.close(index);
                    parent.location.reload();
                })


            })

            
        });

    </script>
      </div>
    </div>
</div>
</body>
<html>
